-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: move ssrContext setting to core (#349, #370) #376
Conversation
@@ -80,5 +80,12 @@ export default { | |||
this.$route.path | |||
) | |||
} | |||
}, | |||
created () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be placed here, or it will be invoked for each component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't put it here, we have some other choices:
- Ask users to put it mannually into the custom
Layout.vue
- Wrap the
themeLayout
with another component, to which inject this snippets. fix: move ssrContext and updateMeta to core (#349, #370) #389
return { | ||
path: '', | ||
frontmatter: {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it to fix some bugs, or?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, there will be errors rendering NotFound.vue
, as there is no $page
match it. So we have to return an empty
page data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact it to fix a bug, and this bug has something to do with this PR.
I'll extract it to another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ssrContext
is necessary for SSR, so it should be in the core, not in the default theme. Title and description in custom theme #349NotFound.vue
doesn't match any$page
, so I provide an empty page data for it inlib/app/util.js/findPageForPath
, or errors will occur when rendering it. NotFound.vue missing title and description #370dataMixin
is not onlydata
after this PR, consider renaming it toglobalMixin
? @ulivz